<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数初步</title>
</head>
<body>
    <script type="text/javascript">
    function sum(a,b) {
       //a和b都是变量名，随意，不需要指明数据类型
       //函数必须手动调用才行
       alert(a+b);
    }
    sum(12,"sad");
    sayHello = function(userName) {
        alert("hello" + userName);
    }
    sayHello("zhangsan");
    </script>
    <input type="button" value="hello" onclick="sayHello('jack');"/>
</body>
</html>